package com.yao.consumer.controller;


import domain.User;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import service.UserService;

/**
 * @author yao
 */
@RestController
public class UserControllerB {
    /**
     * use annotation  @Reference to look up service from registry ,you also can use filed version to assign which version
     */
    @Reference(version = "2.0" // 表明使用的提供者的版本（多版本控制，灰度升级）
            , check = false // 标识对是否有提供者进行检查
            , group = "B"  // 表明所使用的提供者的组
    )
    private UserService userService;

    @GetMapping("/helloB")
    public String hello(@RequestParam String name) {
        return userService.sayHello(new User(name));

    }
}
